package dao

import (
	"soul/initiate"
	"soul/model"
)

func LoginUserByPhone(phone string, password string, code string) (user model.User) {
	err := initiate.DB.Where("phone =?", phone).Where("password =?", password).Find(&user).Error
	if err != nil {
		return model.User{}
	}
	return user
}

func CreateUserByPhone(phone string, password string) (user model.User) {
	user = model.User{
		Phone:    phone,
		Password: password,
	}
	err := initiate.DB.Create(&user).Error
	if err != nil {
		return model.User{}
	}
	return user
}
